class Solution 
{
public:
    vector<int> diStringMatch(string s) 
    {
        int l=0,r=s.size();
        vector<int> ret;
        for(auto &ch:s)
        {
            if(ch=='I')
            {
                ret.push_back(l++);
            }
            else
            {
                ret.push_back(r--);
            }
        }
        ret.push_back(l);
        return ret;
    }
};